import request from '@/utils/jsonReq'

export function getList(page,limit) {
  return request({
    url: `/spendingList?_page=${page}&_limit=${limit}`,
    method: 'get'
  })
}
export function updateListItem(id,data){
  return request({
    url: `/spendingList/${id}`,
    method: 'put',
    data
  })
}
export function deleteListItem(id){
  return request({
    url: `/spendingList/${id}`,
    method: 'delete'
  })
}
export function addListItem(data){
  return request({
    url: `/spendingList`,
    method: 'post',
    data
  })
}
// 根据月份返回数据
export function returnMonthSpending(data){
  return request({
    url: `/spendingList?_sort=time&_order=asc`,
    method: 'get',
    params:{
      q:data
    }
  })
}
export function getThreeList(page,limit) {
  return request({
    url: `/spendingList?_sort=price&_order=desc&_page=1&_limit=3`,
    method: 'get'
  })
}
